<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>catjiu-onlyoffice</title>
		<script type="text/javascript" src="http://192.168.247.128:9001/web-apps/apps/api/documents/api.js"></script>
	</head>
	<body>
		<div id='office' style="height: 1000px;width: 800px;"></div>
	</body>
	<script>
		var config = {
			"type": "desktop",
			"width": "1280px",
			"height": "600px",
			"documentType": "word",
			"token": "token-1",
			"document": {
				"title": "pqjk.doc",
				"url": "http://172.27.41.181:7025/office/download?fileName=pqjk.doc",
				"fileType": "doc",
				"key": "14c2872e62c495c8708db06897ed62",
				"vkey": "vkey-1",
				"info": {
					"owner": "liuwanli_email@163.com",
					"folder": "/root/",
					"uploaded": "2020-01-03T02:28:28.000+0000",
				},
				"permissions": {
					"edit": true,
					"download": false,
					"review": false,
					"print": false,
					"changeHistory": false,
					"comment": false,
					"modifyFilter": false,
					"modifyContentControl": true,
					"fillForms": false,
					"copy": true,
					"editCommentAuthorOnly": true,
					"deleteCommentAuthorOnly": true,
					"protect": false
				}
			},
			"editorConfig": {
				"actionLink": {
					"action": {
						"type": "bookmark",
						"data": "书签1-1"
					}
				},
				"mode": "edit",
				//en-ch 英文模式/zh-CN 中文模式，onlyoffice自身支持汉化，不存在网上那些加入字体后汉化的说法（我的版本是5.4.2-46），加入字体是在编辑文档的时候用的，后续会讲到
				"lang": "zh-cn",
				"location": "zh-cn",
				"canCoAuthoring": true,
				//文档编辑的回调，在编辑完成后，关闭该页面后的10S左右，onlyoffice服务会通过该接口将编辑后的文档流推送过来
				"callbackUrl": "http://172.27.41.181:7025/office/save",
				// "createUrl":"http://172.27.41.181:7025/office/create",
				"sharingSettingsUrl": "",
				"saveAsUrl": "folder",
				"licenseUrl": "",
				"customerId": "1",
				"region": "zh-cn",
				"user": {
					"id": "zs",
					"name": "張三"
				},
				"customization": {
				 "about": false,
					"chat": false,
					"comments": false,
					'compactToolbar': false,
					'autosave': true,
					'forcesave': false,
					'help': false,
					'compactHeader': false,
					'toolbarNoTabs': false,
					'toolbarHideFileName': false,
					'compatibleFeatures': false,
					'unit': 'cm', // cm, pt, inch,
				 'mentionShare': true, // customize tooltip for mention,
				 'macros': true, // can run macros in document
					'plugins': false, // can run plugins in document
					'macrosMode': 'warn', // warn about automatic macros, 'enable', 'disable', 'warn',
					'hideRulers': false, // hide or show rulers on first loading (presentation or document editor)
					'hideNotes': false, // hide or show notes panel on first loading (presentation editor)
					'uiTheme': 'default-light' // set interface theme: id or default-dark/default-light
				},
			},
			'events': {
				'onAppReady': function() {
					console.log("ready")
				},
				'onDocumentStateChange': function() {
					console.log("onDocumentStateChange")
				},
				'onDocumentReady': function() {
					console.log("onDocumentReady")
				},
				'onRequestEditRights': function() {
					console.log("onRequestEditRights")
				}, //<request rights for switching from view to edit>,
				'onRequestHistory': function() {
					console.log("onRequestHistory")
				}, //<request version history>,// must call refreshHistory method
				'onRequestHistoryData': function() {
					console.log("onRequestHistoryData")
				}, //<request version data>,// must call setHistoryData method
				'onRequestRestore': function() {
					console.log("onRequestRestore")
				}, //<try to restore selected version>,
				'onRequestHistoryClose': function() {
					console.log("onRequestHistoryClose")
				}, //<request closing history>,
				'onError': function() {
					console.log("onError")
				}, //<error callback>,
				'onWarning': function() {
					console.log("onWarning")
				}, //<warning callback>,
				'onInfo': function() {
					console.log("onInfo")
				}, //<document open callback>,// send view or edit mode
				'onOutdatedVersion': function() {
					console.log("onOutdatedVersion")
				}, //<outdated version callback>,// send when  previous version is opened
				'onDownloadAs': function() {
					console.log("onDownloadAs")
				}, //<download as callback>,// send url of downloaded file as a response for downloadAs method
				'onRequestSaveAs': function() {
					console.log("onRequestSaveAs")
				}, //<try to save copy of the document>,
				'onCollaborativeChanges': function() {
					console.log("onCollaborativeChanges")
				}, //<co-editing changes callback>,// send when other user co-edit document
				'onRequestRename': function() {
					console.log("onRequestRename")
				}, //<try to rename document>,
				'onMetaChange': function() {
					console.log("onMetaChange")
				}, // send when meta information changed
				'onRequestClose': function() {
					console.log("onRequestClose")
				}, //<request close editor>,
				'onMakeActionLink': function() {
					console.log("onMakeActionLink")
				}, //<request link to document with bookmark, comment...>,// must call setActionLink method
				'onRequestUsers': function() {
					console.log("onRequestUsers")
				}, //<request users list for mentions>,// must call setUsers method
				'onRequestSendNotify': function() {
					console.log("onRequestSendNotify")
				}, ////send when user is mentioned in a comment,
				'onRequestInsertImage': function() {
					console.log("onRequestInsertImage")
				}, //<try to insert image>,// must call insertImage method
				'onRequestCompareFile': function() {
					console.log("onRequestCompareFile")
				}, //<request file to compare>,// must call setRevisedFile method
				'onRequestSharingSettings': function() {
					console.log("onRequestSharingSettings")
				}, //<request sharing settings>,// must call setSharingSettings method
				'onRequestCreateNew': function() {
					console.log("onRequestCreateNew")
				}, //<try to create document>,
			}
		}
		var docEditor = new DocsAPI.DocEditor("office", config);
		document.querySelector("li[data-layout-name='toolbar-file']")[0].style.display = "none";
	</script>
</html>
